package corejava;

/**
 * @author Sushil
 *
 */

public class Television {
	

	String make;
	String model;
	boolean isOn;
	int size;
	int channelNo;
	
	

	void switchOn() {
		if (!isOn) {
			isOn = true;
		} else {
			System.out.println("TV is already on.");
		}
	}

	void displayInfo() {
		System.out.println("TV is made by - " + make);
		System.out.println("TV model is - " + model);
		System.out.println("TV is " + size + "inches in size");

		if (isOn) {

			System.out.println("The TV is ON");
		} else {
			System.out.println("TV is OFF");
		}

	}
	
	int increaseChannelNo(int numberOfChannels){
		
		if (isOn) {
			channelNo = channelNo + numberOfChannels;			
		}
		else {
			System.out.println("TV is not ON. No channel to display.");			
		}
		
		return channelNo;
	}
	
	
	
	/**
	 * This method displays the name of the channel based on the channel number if the TV is on, otherwise displays a message on the console.
	 *  
	 */
	void displayChannelName(){
		
		if (isOn) {
			
		String channelName = "";
		
		switch (channelNo) {
		case 1:
			channelName = "HBO";
			break;
		case 2:
			channelName = "CNN";
			break;
		case 3:
			channelName = "NBC";
			break;
		case 4:
			channelName = "FOX";
			break;
		case 5:
			channelName = "FTV";
			break;

		default:
			
			break;
		}
		
		System.out.println(channelName);
		}
		
		else {
			System.out.println("Turn on the TV");
		}
		
	}
	
	Boolean isAgeRestrictedChannel(int age)	
	{
		
		
		if (age < 16 && channelNo == 5) {
			
			System.out.println("Warning: This is an age restricted channel");
			return true;
			
		}
		else {
			System.out.println("This is not an age restricted channel");
			return false;
		}
		 
	}
}
